<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img{
            width: 200px;
            height: 200px;
        }
        body{
            background: no-repeat;
            background-size: 100%;
        }
        .boxOAne{
            background-color: pink;
            width: 100px;
            height: 100px;
            margin: auto;
            border: 1px solid;
        }
        
    </style>
</head>
<body>
    <div>
        <input type="button" value="替换文字" onclick="change()">
        <div class="list">
            <img alt="这是图片" title="这是可以移动的图" src="./bjt1.jpg">
            <img alt="这是图片" title="这是可以移动的图" src="./bjt1.jpg">
            <img alt="这是图片" title="这是可以移动的图" src="./bjt1.jpg">
        </div>
    </div>
    <input class="input" type="button" value="点击">
    <div id="box"></div>
    <script>
        let ipt = document.querySelector('input');
        function change(){
            let list = document.querySelector('.list').querySelectorAll('img');
            for(let i = 0; i<list.length;i++){
                console.log(list[i]);
                list[0].src='./bjt2.jpg';
                list[1].src='./bjt3.jpg';
                list[2].src='./bjt1.jpg';
                list[i].title='这是修改后的的'+i+''
                list[i].alt = '这是图'+i+''
                list[i].onclick=function(){
                    document.body.style.background = 'url('+ this.src +')'
                }
            }
        }

        let input = document.querySelector('.input')
        input.onclick = function(){
            // let set = input.nextSibling.nextSibling.style
            // set.width='200px'
            // set.height='200px'
            // set.background='pink'
            // set.border='2px solid red'
           document.querySelector('#box').setAttribute('class','boxOAne')
           console.log(document.querySelector('#box').getAttribute('class'))
        }
    </script>
</body>
</html>